Skip to content

Statement 12: Add geometry submission foundation (mesh/index/instance buffers, batching, instancing) - #12

Merged
ercmine merged 1 commit into
mainfrom
codex/implement-geometry-submission-and-batching-rules
Apr 6, 2026
Merged

Statement 12: Add geometry submission foundation (mesh/index/instance buffers, batching, instancing)#12
ercmine merged 1 commit into
mainfrom
codex/implement-geometry-submission-and-batching-rules

Conversation

@ercmine

@ercmine ercmine commented Apr 6, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Provide an engine-owned, practical geometry submission path for procedural content that avoids leaking backend handles and supports frequent CPU-side mesh creation and updates.
  • Establish canonical vertex layout validation, CPU mesh representation, and clear upload/update contracts so procedural systems can build and push geometry safely.
  • Implement deterministic batching and an explicit instancing policy so repeated objects can be rendered efficiently without changing higher-level scene APIs.

Description

  • Introduced engine-owned vertex/layout, mesh/index/instance buffer descriptors, CPU mesh bridge and validation in engine/render/buffer_types.* and wired layout validation into the bgfx backend.
  • Added draw submission, batch key/policy, batch builder, and diagnostics in engine/render/draw_submission.* and extended Renderer API to create/update mesh/index/instance buffers and to submit unique or instanced draws (submit / submit_instanced).
  • Implemented backend translation and submission in the bgfx renderer (engine/render/bgfx/renderer_bgfx.cpp) including index type mapping, index/vertex creation, instanced submission via bgfx instance buffers, and safe destruction paths.
  • Integrated scene -> renderer flow in the runtime shell (engine/shell/main.cpp) to extract visible renderables, build DrawSubmission records, run batch planning, and emit either unique or instanced submissions; updated scene renderable bindings to use the new material/mesh fields.

Testing

  • Added a deterministic unit test tests/render/geometry_submission_tests.cpp that validates vertex layout, CPU mesh data consistency, batching grouping, and instancing threshold behavior and wired it into CMake/CTest as unit.renderer.geometry_submission.
  • Ran CMake configure (cmake --preset linux-debug) to validate project changes, but configuration failed due to unresolved external dependencies (SDL3/bgfx) in the environment so a full build and test run could not be completed.
  • Existing unit tests and scene tests were updated to reflect new renderable bindings, but automated execution of the test suite was not possible in this environment due to the missing native dependencies.

Codex Task

@ercmine
ercmine merged commit a977b43 into main Apr 6, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant